package com.cyx.exam.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyx.exam.entity.QuAnswer;
import com.cyx.exam.entity.User;
import com.cyx.exam.mapper.QuAnswerMapper;
import com.cyx.exam.mapper.UserMapper;
import com.cyx.exam.service.QuAnswerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 候选答案 服务实现类
 * </p>
 *
 * @author cyx
 * @since 2021-03-09
 */
@Service
public class QuAnswerServiceImpl extends ServiceImpl<QuAnswerMapper, QuAnswer> implements QuAnswerService {

    @Resource
    private QuAnswerMapper quAnswerMapper;

    @Override
    public int delete(Integer id) {
        QueryWrapper<QuAnswer> wrapper = new QueryWrapper<QuAnswer>();
        wrapper.eq("id",id);
        return quAnswerMapper.delete(wrapper);
    }

    @Override
    public int deleteByQuId(Integer quId) {
        QueryWrapper<QuAnswer> wrapper = new QueryWrapper<QuAnswer>();
        wrapper.eq("qu_id",quId);
        return quAnswerMapper.delete(wrapper);
    }

    @Override
    public List<Integer> selectRightAnswer(Integer quId) {
        return quAnswerMapper.selectRightAnswer(quId);
    }
}
